package com.agileai.crm.bizmoduler.procustomer;

import com.agileai.common.KeyGenerator;
import com.agileai.domain.DataParam;
import com.agileai.domain.DataRow;
import com.agileai.hotweb.bizmoduler.core.StandardServiceImpl;

public class OrgInfoManageImpl
        extends StandardServiceImpl
        implements OrgInfoManage {
    public OrgInfoManageImpl() {
        super();
    }
	public void createClueRecord(DataParam param) {
		String statementId = sqlNameSpace+"."+"createClueRecord";
		String clueId = KeyGenerator.instance().genKey();
   		param.put("CLUE_ID",clueId);
		processDataType(param, tableName);
		processPrimaryKeys(param);
		this.daoHelper.insertRecord(statementId, param);
	}
	@Override
	public void createCustomerRecord(DataParam param) {
		String statementId = sqlNameSpace+"."+"createCustomerRecord";
		String custId = KeyGenerator.instance().genKey();
   		param.put("CUST_ID",custId);
		processDataType(param, tableName);
		processPrimaryKeys(param);
		this.daoHelper.insertRecord(statementId, param);
		
		statementId = sqlNameSpace+"."+"getGrpCodeRecord";
		param.put("GRP_CODE","TEMP");
		DataRow result = this.daoHelper.getRecord(statementId, param);
		String grpId = result.getString("GRP_ID");
		statementId = sqlNameSpace+"."+"createCustomerGrpRecord";
		DataParam newParam = new DataParam();
		newParam.put("GRP_ID",grpId);
		newParam.put("CUST_ID",param.get("CUST_ID"));
		this.daoHelper.insertRecord(statementId, newParam);
	}
	@Override
	public void changeStateRecord(DataParam param) {
		String statementId = sqlNameSpace+"."+"changeStateRecord";
		processDataType(param, tableName);
		this.daoHelper.updateRecord(statementId, param);
	}
	
	
}
